<template>
	<!-- 列表项 -->
	<view class="card" :style="isShow ? '' : 'height: 50px;'">
		<view class="card_title">
			<view class="card_title_left">
				<image style="width: 1.2rem;; height: 1.2rem;"
					src='~@/static/images/correction/correction-warn-flow.png'>
				</image>
				处置流程
			</view>
			<view class="card_title_right">
				<u-icon @click="toShow()" :name="isShow ? 'arrow-down' : 'arrow-up'" size="20"></u-icon>
			</view>
		</view>

		<view v-if="isShow">
			<view v-if="recordList.length > 0">
				<u-divider style="margin: 0 0 0.6rem 0;"></u-divider>
				<view class="card_records">
					<view v-for="(item, index) in recordList" :key="index" class="card_records_item">
						<view class="card_records_item_right"
							:style="index == recordList.length - 1 ? 'border-left: 1px solid #fff;' : ''">
							<view class="card_records_item_right_icon">
								✓
							</view>

							<view v-text="item.exectime" class="card_records_item_right_time">
							</view>
							<view v-text="item.record" class="card_records_item_right_addr">
							</view>
						</view>
					</view>
				</view>
			</view>
			<u-empty v-else style="margin-bottom: 4%;" mode="data">
			</u-empty>
		</view>
	</view>

</template>

<script>
	import {
		findListByWarnId
	} from '@/common/api/correction/cre_work_record.js'

	export default {
		props: {
			warnid: {
				type: String,
				require: true
			},
		},
		data() {
			return {
				isShow: true,
				recordList: [],
			}
		},
		created() {
			this.queryList(this.warnid)
		},
		methods: {
			toShow() {
				this.isShow = !this.isShow
			},
			async queryList(warnid) {
				const {
					data
				} = await findListByWarnId(warnid)
				console.log('处置记录', data)
				this.recordList = data || []
			}
		}
	}
</script>

<style lang="scss" scoped>
	@import '@/static/css/flex.scss';

	::v-deep .u-radio {
		width: 33%;
	}

	// 列表项
	.card {
		box-shadow: 0rpx 4rpx 10rpx #ccc;
		border-radius: 20rpx;
		background-color: #ffffff;
		margin-bottom: 60rpx;
		width: 86%;
		// height: 30%;
		position: relative;
		// border: 1px solid red;
		padding: 0% 4%;
		height: 390rpx;

		// padding-bottom: 30px;
		&_title {
			height: 50px;
			@extend .space_between;
			align-items: center;
			// border: 1px solid red;

			&_left {
				width: 94%;
				display: flex;
				align-items: center;

				image {
					margin-right: 0.6rem;
				}
			}

			&_right {
				// width: 3%;
				// border: 1px solid red;
				margin-right: 4%;
			}

		}

		&_records {
			// height: 66%;
			// border: 1px solid blue;
			overflow: auto;
			max-height: 130px;

			&_item {
				width: 100%;
				height: 70px;

				// border: 1px solid red;	
				@extend .algin_justity_center;

				&_right {
					border-left: 1px solid #B7B7B7;
					width: 80%;
					height: 100%;
					position: relative;
					padding-left: 6%;

					// 自定义步骤条图标
					&_icon {
						width: 20px;
						height: 20px;
						border-radius: 20px;
						color: #fff;
						background-color: #00B853;
						@extend .algin_justity_center;
						position: absolute;
						left: -10px;
					}

					&_time {
						// height: 30%;
					}

					&_addr {
						padding-top: 1%;
						height: 50%;
						color: #bbb;
						// border: 1px solid red;
					}
				}
			}

		}
	}
</style>